<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:fragment xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">
	<f:view locale="#{i18N.locale}">
	<p:panel header="#{msgs.definicao}">
		<p:accordionPanel>

			<p:tab title="Objetivos">

				<h:panelGrid columns="1">

					<h:outputText value="#{msgs.objetoDeEstudo}" />
					<p:editor id="obj" value="#{protocolMB.definition.object}"
						cols="60" />
					<br />
					<h:outputText value="#{msgs.objetivoGlobal}" />
					<p:editor id="globalobj"
						value="#{protocolMB.definition.globalObject}" cols="60" />

				</h:panelGrid>

			</p:tab>

			<p:tab title="#{msgs.objetivosEsp}">
				<h:panelGrid columns="2">
					<h:outputText value="#{msgs.analizar}" />
					<p:inputText value="#{protocolMB.definition.parse}" />

					<h:outputText value="#{msgs.proposito}" />
					<p:inputText value="#{protocolMB.definition.purpose}" />

					<h:outputText value="#{msgs.respeito}" />
					<p:inputText value="#{protocolMB.definition.respect}" />

					<h:outputText value="#{msgs.pontovista}" />
					<p:inputText value="#{protocolMB.definition.pointOfView}" />

					<h:outputText value="#{msgs.context}" />
					<p:inputText value="#{protocolMB.definition.context}" />

				</h:panelGrid>
			</p:tab>

			<p:tab title="#{msgs.focoDeQualidade}">
				<p:outputLabel value="#{msgs.focoDeQualidade}"
					styleClass="ui-widget" />
				<p:inputText value="#{protocolMB.definition.qualityFocus}" />
			</p:tab>

			<p:tab title="#{msgs.contexto}">

				<h:panelGrid columns="2">

					<h:outputText value="#{msgs.processo}" />
					<p:selectOneMenu value="#{protocolMB.definition.process}">
						<f:selectItem itemLabel="Selecione um processo" itemValue="" />
						<f:selectItems value="#{protocolMB.process}" var="pro"
							itemLabel="#{pro.nome}" itemValue="#{pro}" />
					</p:selectOneMenu>

					<h:outputText value="#{msgs.participantes}" />
					<p:inputText value="#{protocolMB.definition.participante}" />

					<h:outputText value="#{msgs.realidade}" />
					<p:selectOneMenu value="#{protocolMB.definition.reality}">
						<f:selectItem itemLabel="Selecione" itemValue="" />
						<f:selectItems value="#{protocolMB.reality}" var="pro"
							itemLabel="#{pro.nome}" itemValue="#{pro}" />
					</p:selectOneMenu>

					<h:outputText value="#{msgs.generalidade}" />
					<p:selectOneMenu value="#{protocolMB.definition.generality}">
						<f:selectItem itemLabel="Selecione" itemValue="" />
						<f:selectItems value="#{protocolMB.generality}" var="pro"
							itemLabel="#{pro.nome}" itemValue="#{pro}" />
					</p:selectOneMenu>

				</h:panelGrid>

			</p:tab>

			<p:tab title="#{msgs.questoesemetricas}">
				<p:fieldset legend="#{msgs.metrics}">
					<h:form>
						<h:panelGrid columns="3">
							<h:outputText value="#{msgs.nomeMetric}" />
							<p:inputText id="met" value="#{protocolMB.metric.description}" />
							<p:commandButton icon="ui-icon-plusthick"
								action="#{protocolMB.adicionaMetrica}" update="listMetric met"
								ajax="true" />
						</h:panelGrid>

						<p:dataTable id="listMetric" value="#{protocolMB.listaMetricas}"
							var="metric" emptyMessage="#{msgs.semdados}"
							rowKey="#{metric.description}"
							selection="#{protocolMB.selectedMetric}" selectionMode="single" >
							<p:ajax event="rowSelect" listener="#{protocolMB.setSelectedMetric}"/> 
							<p:column headerText="Id" width="10%">
								<h:outputText value="#{metric.id.metric}" />
							</p:column>

							<p:column headerText="#{msgs.descricao}" width="80%">
								<h:outputText value="#{metric.description}" />
							</p:column>

							<p:column width="10%">
								<h:commandLink value="#{msgs.excluir}"
									actionListener="#{protocolMB.removeMetrica(metrics)}" />
							</p:column>

						</p:dataTable>
					</h:form>
				</p:fieldset>
				<br />
				<p:fieldset legend="#{msgs.questoes}">
					<h:form id="question">
						<h:panelGrid columns="3">
							<h:outputText value="#{msgs.descQuestoes}" />
							<p:inputText id="Quest"
								value="#{protocolMB.question.description}" />
							<p:commandButton action="#{protocolMB.adicionaQuestion}"
								icon="ui-icon-plusthick" update="listQ Quest" ajax="true" process="@this Quest" />
						</h:panelGrid>

						<p:dataTable id="listQ" value="#{protocolMB.listaQuestions}"
							var="question" emptyMessage="#{msgs.semdados}">
							<p:column headerText="Id Metric" width="10%" >
								<h:outputText value="#{question.metric.id.metric}" />
							</p:column>
							<p:column headerText="#{msgs.Description}" width="80%" >
								<h:outputText value="#{question.description}" />
							</p:column>

							<p:column headerText="#{msgs.Description}" width="10%" >
								<h:commandLink value="#{msgs.excluir}"
									actionListener="#{protocolMB.removeQuestion(question)}" />
							</p:column>

						</p:dataTable>
					</h:form>
				</p:fieldset>
			</p:tab>

			<p:tab title="#{msgs.outrasquestoes}">

				<h:outputText value="#{msgs.questoesdoestudo}" />
				<br />
				<p:editor value="#{protocolMB.definition.questionNotAnswered}"
					cols="60" />
				<br />
				<br />
				<p:outputLabel value="#{msgs.questoesabertas}" />
				<br />
				<p:editor value="#{protocolMB.definition.openQuestion}" cols="60" />

			</p:tab>

		</p:accordionPanel>

	</p:panel>
	</f:view>
</ui:fragment>